<?php
namespace App\Resource\Web;

use Hyperf\Resource\Json\JsonResource as BaseJsonResource;

abstract class JsonResource extends BaseJsonResource
{
    /**
     * 响应结构
     */
    public function toArray(): array
    {
        return [
            'code' => 200,
            'message' => 'success',
            'data' => $this->getData(),
        ];
    }

    /**
     * 获取数据
     */
    abstract protected function getData(): array;
}